From 46cb1e56f756fd3a14d02807ac64aabb71c2ee3e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Florian=20M=C3=BCllner?= Date: Thu, 27 Nov 2025 16:29:44 +0100 Subject: [PATCH] test-tool: Set up GSettings keyfile Even with a separate XDG_CONFIG_HOME, settings may still be picked up from the session's dconf instance (although the tool is typically run through dbus-run-session). To really ensure that we control the settings, we can force a different backend. The 'memory' backend would be enough to ensure default values, however using the 'keyfile' backend means we can also inject non-default values. Part-of: --- src/gnome-shell-test-tool.in | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/gnome-shell-test-tool.in b/src/gnome-shell-test-tool.in index 35380da66..43348f126 100755 --- a/src/gnome-shell-test-tool.in +++ b/src/gnome-shell-test-tool.in @@ -11,6 +11,20 @@ import os import subprocess import sys import tempfile +from configparser import ConfigParser +from pathlib import Path + +class GSettingsConfig(ConfigParser): + def add(self, path, key, value): + if not path in self: + self[path] = {} + self[path][key] = value + + def save(self, xdg_home): + dir = f'{xdg_home}/config/glib-2.0/settings' + Path(dir).mkdir(parents=True) + with open(f'{dir}/keyfile', 'w') as keyfile: + self.write(keyfile) def show_version(option, opt_str, value, parser): print("GNOME Shell Test Tool @VERSION@") @@ -30,6 +44,10 @@ def start_shell(xdg_home, wrap=None, perf_output=None): if perf_output is not None: env['SHELL_PERF_OUTPUT'] = perf_output + env['GSETTINGS_BACKEND'] = 'keyfile' + + gsettings_config = GSettingsConfig() + # A fixed background image if os.getenv('SHELL_BACKGROUND_IMAGE') is None: env['SHELL_BACKGROUND_IMAGE'] = '@pkgdatadir@/perf-background.xml' @@ -58,6 +76,8 @@ def start_shell(xdg_home, wrap=None, perf_output=None): args.append('--wayland-display') args.append('gnome-shell-test-display') + gsettings_config.save(xdg_home) + print("args: {}".format(args)) return subprocess.Popen(args, env=env) -- 2.39.5